package com.yangwudi.controller;


import com.yangwudi.exception.LoginException;
import com.yangwudi.pojo.Emp;
import com.yangwudi.pojo.LoginInfo;
import com.yangwudi.pojo.Result;
import com.yangwudi.service.EmpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/login")
@RestController
public class LoginController {
    @Autowired
    private EmpService empService;


    /**
     *登陆
     */
    @PostMapping
    public Result login(@RequestBody Emp  emp) {
        log.info("员工登陆:{}",emp);
            LoginInfo loginInfo = empService.login(emp);
            return Result.success(loginInfo);
    }
}
